package com.chenglu.android.goodsinfo.adapter;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.common.utils.Utils;
import com.chenglu.android.goodsinfo.bean.ShopCouponPage;

import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023 6 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：
 */
public class DetailCouponAdapter extends BaseQuickAdapter<ShopCouponPage.Data.Records, BaseViewHolder> {

     Context mContext;
    public DetailCouponAdapter(Context context, @Nullable List<ShopCouponPage.Data.Records> data) {
        super(R.layout.item_detail_coupon ,data);
        this.mContext = context;
    }
      boolean isShow = true;
    @Override
    protected void convert(@NonNull BaseViewHolder helper, ShopCouponPage.Data.Records item) {

        if(item==null){
            return;
        }
        if(item.getCouponUseType()==1){
//            优惠券类型1、满减 2、折扣
            if(item.getMinMoney()==0.0){
                helper.setText(R.id.tv_coupon_name,"无门槛"+"减"+Utils.doubleTrans2(item.getCouponAmount()));
            }else {
                helper.setText(R.id.tv_coupon_name,"满"+Utils.doubleTrans2(item.getMinMoney())+"减"+Utils.doubleTrans2(item.getCouponAmount()));
            }

        }else if(item.getCouponUseType()==2){
            helper.setText(R.id.tv_coupon_name,"满"+Utils.doubleTrans2(item.getMinMoney())+"打"+Utils.formatZeroNumber(item.getCouponPercentage()));
        }



    }


    //先声明一个int成员变量,若为0默认显示第一个
    private int thisPosition = 1001;

    //点击选择item
    private int thisTagPosition = 1002;

    public int getThisTagPosition() {
        return thisTagPosition;
    }

    public void setThisTagPosition(int thisTagPosition) {
        this.thisTagPosition = thisTagPosition;
    }

    //再定义一个int类型的返回值方法
    public int getthisPosition() {
        return thisPosition;
    }

    //   传入点击的位置
    public void setThisPosition(int thisPosition) {
        this.thisPosition = thisPosition;
        notifyDataSetChanged();
    }
}
